import logging
import requests
from config import Base_Host
class Mepsking_Login:
    def login(self,json_dict):
        url=Base_Host+'/api/admin/auth/login'
        resp=requests.post(url=url,json=json_dict)
        logging.info('登录接口返回的数据为：{}'.format(resp.json()))
        print('登录接口返回的数据为：{}'.format(resp.json()))
        return resp
    def token(self,json_dict):
        token=self.login(json_dict)
        token=token.json().get('result').get('accessToken')
        logging.info('获取到的token为：{}'.format(token))
        return token
if __name__ == '__main__':
    test=Mepsking_Login()
    json_dict={"password": "d4129fb5f167eda9d7492d7d671133e4", "username": "2524726232@qq.com"}
    resp=test.login(json_dict)

